﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NotificationManager.aspx.cs" Inherits="GPSTrackingWebsiteManager.Pages.NotificationsManager" %>

<!DOCTYPE html>
<link href="../Css/GPSTrackingWebsite.css" rel="stylesheet" />
<script src="../Javascript/WindowMessageManager.js"></script>
<script src="../Javascript/ObjectsV2.js"></script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Administrador de Notificaciones</title>
</head>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">

        var opener = GetRadWindow();
        var NotificationManager = new NotificationManager();
        var Companies = new Companies();
        var GeoFences = new GeoFences();

        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow)
                oWindow = window.radWindow;
            else if (window.frameElement.radWindow)
                oWindow = window.frameElement.radWindow;
            return oWindow.BrowserWindow;
        }

        function CompaniesGrid_OnRowClick(sender, args) {
            NotificationManager.clearAllPolygonoGeoFenceList(opener);
            if (GeoFences.isValidToGetGeoFences(getGeoFenceGrid(), opener.globalNotificationManager.companyIDSelected, args.getDataKeyValue("CompanyID"), opener.globalNotificationManager.geoFencesList, opener.globalNotificationManager.companiesList, opener.globalNotificationManager.geoFencesDataSource)) {
                opener.globalNotificationManager.companyIDSelected = args.getDataKeyValue("CompanyID");
                opener.globalNotificationManager.geoFenceIDSelected = -1;
                opener.globalNotificationManager.gpsGroupIDSelected = -1;
                clearList(opener.globalNotificationManager.gpsStockList);
                clearDataSource(opener.globalNotificationManager.gpsStockDataSource, getGPSStockGrid(), true);
                getckbNotyToAdmin().checked = false;
                getckbNotyToUser().checked = false;
                getGeoFencesByCompanyID();
                getAllGPSGroupsByCompanyIDAndAdminUsername();
            }
        }

        function getGeoFencesByCompanyID() {
            requestStart(getrpvNotificationManagerUpdateControl());
            clearList(opener.globalNotificationManager.gpsGroupList);
            clearDataSource(opener.globalNotificationManager.gpsGroupDataSource, getGPSGroupGrid(), true);
            PageMethods.wsGetGeoFencesByCompanyID(opener.globalNotificationManager.companyIDSelected, getGeoFencesByCompanyIDOk, getGeoFencesByCompanyIDError);
        }

        function getGeoFencesByCompanyIDOk(object) {

            GeoFences.openXMLGeoFenceDetails(opener, object, opener.globalNotificationManager.geoFencesList);
            GeoFences.loadGeoFenceDataSource(opener.globalNotificationManager.geoFencesDataSource, opener.globalNotificationManager.geoFencesList, getGeoFenceGrid());
            responseEnd(getrpvNotificationManagerUpdateControl());
        }

        function getGeoFencesByCompanyIDError(error) {
            responseEnd(getrpvNotificationManagerUpdateControl());
            msgError(error.get_message(), titles.notifications, opener.globalNotificationManager.widthForMsg);
        }

        /*function getAllGPSGroupsByCompanyIDAndAdminUsername() {
            PageMethods.wsGetAllGPSGroupsByCompanyIDAndAdminUsername(opener.globalNotificationManager.companyIDSelected, getAllGPSGroupsByCompanyIDAndAdminUsernameOk, getAllGPSGroupsByCompanyIDAndAdminUsernameError);
        }

        function getAllGPSGroupsByCompanyIDAndAdminUsernameOk(object) {
            NotificationManager.openXMLGPSGroups(object, opener.globalNotificationManager.gpsGroupList);
            NotificationManager.loadGPSGroupDataSource(getGPSGroupGrid(), opener.globalNotificationManager.gpsGroupList, opener.globalNotificationManager.gpsGroupDataSource);
        }

        function getAllGPSGroupsByCompanyIDAndAdminUsernameError(error) {
            responseEnd(getrpvNotificationManagerUpdateControl());
            msgError(error.get_message(), titles.notifications, opener.globalNotificationManager.widthForMsg);
        }*/

        function getInfo() {
            getCompaniesByAdminUsername();
            getNotifications();
        }

        function getCompaniesByAdminUsername() {
            PageMethods.wsGetCompaniesByAdminUsername(getCompaniesByAdminUsernameOk, getCompaniesByAdminUsernameError);
        }

        function getCompaniesByAdminUsernameOk(object) {
            Companies.openXMLCompaniesByAdminUsername(object, opener.globalNotificationManager.companiesList);
            Companies.loadCompaniesDataSource(getCompaniesGrid(), opener.globalNotificationManager.companiesList, opener.globalNotificationManager.companiesDataSource);
            if (opener.globalNotificationManager.companiesList.length == 1) {
                getCompaniesGrid().selectItem(0);
                if (GeoFences.isValidToGetGeoFences(getGeoFenceGrid(), opener.globalNotificationManager.companyIDSelected, opener.globalNotificationManager.companiesList[0].companyID, opener.globalNotificationManager.geoFencesList, opener.globalNotificationManager.companiesList, opener.globalNotificationManager.geoFencesDataSource)) {
                    opener.globalNotificationManager.companyIDSelected = opener.globalNotificationManager.companiesList[0].companyID;
                    getGeoFencesByCompanyID();
                    getAllGPSGroupsByCompanyIDAndAdminUsername();
                }
            }
        }

        function getCompaniesByAdminUsernameError(error) {
            responseEnd(getrpvNotificationManagerUpdateControl());
            msgError(error.get_message(), titles.notifications, opener.globalNotificationManager.widthForMsg);
        }

        function getNotifications() {
            PageMethods.wsGetAllNotifications_TypeGeoFences(getNotificationsOk, getNotificationsError);
        }

        function getNotificationsOk(object) {
            NotificationManager.openXMLNotifications(object, opener.globalNotificationManager.notificationsList);
            NotificationManager.loadNotificationDataSource(getNotificationGrid(), opener.globalNotificationManager.notificationsList, opener.globalNotificationManager.notificationsDataSource);
        }

        function getNotificationsError(error) {
            responseEnd(getrpvNotificationManagerUpdateControl());
            msgError(error.get_message(), titles.notifications, opener.globalNotificationManager.widthForMsg);
        }

        function GPSStockGrid_OnRowSelection(sender, args) {
            var index = -1;

            index = NotificationManager.getIndexGPSImei(opener.globalNotificationManager.gpsStockList, args.getDataKeyValue("GPSImei"));

            if (index != -1) {
                opener.globalNotificationManager.gpsStockList[index].currentAction = "I";
                opener.globalNotificationManager.gpsImeiSelected = args.getDataKeyValue("GPSImei");
            }
        }

        function GPSStockGrid_OnRowDeselecting(sender, args) {
            var index = -1;

            index = NotificationManager.getIndexGPSImei(opener.globalNotificationManager.gpsStockList, args.getDataKeyValue("GPSImei"));

            if (index != -1) {
                opener.globalNotificationManager.gpsStockList[index].currentAction = "D";
                opener.globalNotificationManager.gpsImeiSelected = args.getDataKeyValue("GPSImei");
            }
        }

        function NotificationsGrid_OnRowClick(sender, args){
            var index = -1;

            index = NotificationManager.getIndexNotificationID(opener.globalNotificationManager.notificationsList, args.getDataKeyValue("NotificationID"));

            if (index != -1) {
                opener.globalNotificationManager.notificationIDSelected = args.getDataKeyValue("NotificationID");
                if (opener.globalNotificationManager.geoFenceIDSelected != -1 && opener.globalNotificationManager.gpsGroupIDSelected != -1) {
                    getAllGPSStockByGPSGroupIDAndNotificationIDAndGeoFenceID();
                }
            }
        }

        //Show Geofence on row selecting
        function GeoFenceGrid_OnRowClick(sender, args) {

            var index = -1;
       
            index = GeoFences.getIndexGeoFenceID(opener.globalNotificationManager.geoFencesList, opener.globalNotificationManager.geoFenceIDSelected);
            if (index != -1) {
                opener.globalNotificationManager.geoFencesList[index].checked = false;
                opener.globalNotificationManager.geoFencesList[index].hideGeoFence(opener);
            }

            index = GeoFences.getIndexGeoFenceID(opener.globalNotificationManager.geoFencesList, args.getDataKeyValue("GeoFenceID"));

            if (index != -1) {
                opener.globalNotificationManager.geoFencesList[index].checked = true;
                opener.objMapControl.centerMap(opener.objMapControl.addPosition(opener.globalNotificationManager.geoFencesList[index].latitudeList[0], opener.globalNotificationManager.geoFencesList[index].longitudeList[0]));
                opener.objMapControl.zoomMap(10);
                opener.globalNotificationManager.geoFencesList[index].showGeoFence(opener);
                opener.globalNotificationManager.geoFenceIDSelected = args.getDataKeyValue("GeoFenceID");
                if (opener.globalNotificationManager.notificationIDSelected != -1 && opener.globalNotificationManager.gpsGroupIDSelected != -1) {
                    getAllGPSStockByGPSGroupIDAndNotificationIDAndGeoFenceID();
                }
            }
        }

        function getAllGPSStockByGPSGroupIDAndNotificationIDAndGeoFenceID() {
            requestStart(getrpvNotificationManagerUpdateControl());
            PageMethods.wsGetAllGPSStockByGPSGroupIDAndNotificationIDAndGeoFenceID(opener.globalNotificationManager.gpsGroupIDSelected, opener.globalNotificationManager.notificationIDSelected, opener.globalNotificationManager.geoFenceIDSelected, getAllGPSStockByGPSGroupIDAndNotificationIDAndGeoFenceIDOk, getAllGPSStockByGPSGroupIDAndNotificationIDAndGeoFenceIDError);
        }

        function getAllGPSStockByGPSGroupIDAndNotificationIDAndGeoFenceIDOk(object) {
            clearList(opener.globalNotificationManager.gpsStockList);
            clearDataSource(opener.globalNotificationManager.gpsStockDataSource, getGPSStockGrid(), true);
            NotificationManager.openXMLGPSStock(object, opener.globalNotificationManager.gpsStockList, opener);
            NotificationManager.loadGPSStockDataSource(getGPSStockGrid(), opener.globalNotificationManager.gpsStockList, opener.globalNotificationManager.gpsStockDataSource);
            getckbNotyToAdmin().checked = opener.globalNotificationManager.lastNotyGeoFenceToSendAdmin;
            getckbNotyToUser().checked = opener.globalNotificationManager.lastNotyGPSImeiToSendUser;
            responseEnd(getrpvNotificationManagerUpdateControl());
        }

        function getAllGPSStockByGPSGroupIDAndNotificationIDAndGeoFenceIDError(error) {
            responseEnd(getrpvNotificationManagerUpdateControl());
            msgError(error.get_message(), titles.notifications, opener.globalNotificationManager.widthForMsg);
        }

        function getAllGPSGroupsByCompanyIDAndAdminUsername() {
            PageMethods.wsGetAllGPSGroupsByCompanyIDAndAdminUsername(opener.globalNotificationManager.companyIDSelected, getAllGPSGroupsByCompanyIDAndAdminUsernameOk, getAllGPSGroupsByCompanyIDAndAdminUsernameError)
        }

        function getAllGPSGroupsByCompanyIDAndAdminUsernameOk(object) {
            NotificationManager.openXMLGPSGroups(object, opener.globalNotificationManager.gpsGroupList);
            NotificationManager.loadGPSGroupDataSource(getGPSGroupGrid(), opener.globalNotificationManager.gpsGroupList, opener.globalNotificationManager.gpsGroupDataSource);
        }

        function getAllGPSGroupsByCompanyIDAndAdminUsernameError(error) {
            responseEnd(getrpvNotificationManagerUpdateControl());
            msgError(error.get_message(), titles.notifications, opener.globalNotificationManager.widthForMsg);
        }

        function clearGeoFenceSelected()
        {
            var index = GeoFences.getIndexGeoFenceID(opener.globalNotificationManager.geoFencesList, opener.globalNotificationManager.geoFenceIDSelected);
            if (index != -1) {
                opener.globalNotificationManager.geoFencesList[index].hideGeoFence(opener);
                getGeoFenceGrid().clearSelectedItems();
                opener.globalNotificationManager.geoFenceIDSelected = -1;
                getAllGPSStockByGPSGroupIDAndNotificationIDAndGeoFenceID();
            }
        }

        function GPSGroupsGrid_OnRowClick(sender, args){

            var index = -1;

            index = NotificationManager.getIndexGPSGroupID(opener.globalNotificationManager.gpsGroupList, args.getDataKeyValue("GPSGroupID"));

            if (index != -1) {
                opener.globalNotificationManager.gpsGroupIDSelected = args.getDataKeyValue("GPSGroupID");
                getAllGPSStockByGPSGroupIDAndNotificationIDAndGeoFenceID();
            }
        }

        function isValidToInsertNotifications() {
            if(NotificationManager.isValidToInsertNotifications(opener)){
                requestStart(getrpvNotificationManagerUpdateControl());
                notificationsInsert_Delete_Update_TypeGeoFences();
            }
        }

        function notificationsInsert_Delete_Update_TypeGeoFences() {
            var gpsImeiListToInsert = [];
            var gpsImeiListToDelete = [];

            for (i = 0; i < opener.globalNotificationManager.gpsImeiListToInsert.length; i++) { gpsImeiListToInsert.push(opener.globalNotificationManager.gpsImeiListToInsert[i].toString()); }
            for (i = 0; i < opener.globalNotificationManager.gpsImeiListToDelete.length; i++) { gpsImeiListToDelete.push(opener.globalNotificationManager.gpsImeiListToDelete[i].toString()); }

            PageMethods.wsNotificationsInsert_Delete_Update_TypeGeoFences(opener.globalNotificationManager.geoFenceIDSelected, opener.globalNotificationManager.currentNotyGeoFenceToSendAdmin, opener.globalNotificationManager.isUpdateNotyGeoFenceToSendAdmin, opener.globalNotificationManager.currentNotyGPSImeiToSendUser, opener.globalNotificationManager.isUpdateNotyGPSImeiToSendUser, opener.globalNotificationManager.notificationIDSelected, gpsImeiListToInsert, gpsImeiListToDelete, notificationsInsert_Delete_Update_TypeGeoFencesOk, notificationsInsert_Delete_Update_TypeGeoFencesError)
        }

        function notificationsInsert_Delete_Update_TypeGeoFencesOk(object) {
            opener.globalNotificationManager.lastNotyGeoFenceToSendAdmin = opener.globalNotificationManager.currentNotyGeoFenceToSendAdmin;
            opener.globalNotificationManager.lastNotyGPSImeiToSendUser = opener.globalNotificationManager.currentNotyGPSImeiToSendUser;
            for (i = 0; i < opener.globalNotificationManager.gpsStockList.length; i++) { opener.globalNotificationManager.gpsStockList[i].lastAction = opener.globalNotificationManager.gpsStockList[i].currentAction; }

            msgInformation("Se asociaron las notificaciones satisfactoriamente", titles.notifications, opener.globalNotificationManager.widthForMsg);
            responseEnd(getrpvNotificationManagerUpdateControl());
        }

        function notificationsInsert_Delete_Update_TypeGeoFencesError(error) {
            responseEnd(getrpvNotificationManagerUpdateControl());
            msgError(error.get_message(), titles.notifications, opener.globalNotificationManager.widthForMsg);
        }

        function CheckUncheckckbNotyToAdmin() {
            opener.globalNotificationManager.currentNotyGeoFenceToSendAdmin = getckbNotyToAdmin().checked;
        }

        function CheckUncheckckbNotyToUser() {
            opener.globalNotificationManager.currentNotyGPSImeiToSendUser = getckbNotyToUser().checked;
        }

        function getCompaniesGrid() {
            try {
                return $find("<%= rgCompaniesGrid.ClientID %>").get_masterTableView();
            }
            catch (ex) {
                setTimeout(getCompaniesGrid, 100);
            }
        }

        function getGPSGroupGrid() {
            try {
                return $find("<%= rgGPSGroupsGrid.ClientID %>").get_masterTableView();
            }
            catch (ex) {
                setTimeout(getCompaniesGrid, 100);
            }
        }

        function getGeoFenceGrid() {
            try {
                return $find("<%= rgGeoFenceGrid.ClientID %>").get_masterTableView();
            }
            catch (ex) {
                setTimeout(getGeoFenceGrid, 100);
            }
        }

        function getGPSStockGrid() {
            try {
                return $find("<%= rgGPSStockGrid.ClientID %>").get_masterTableView();
            }
            catch (ex) {
                setTimeout(getGPSStockGrid, 100);
            }
        }

        function getNotificationGrid() {
            try {
                return $find("<%= rgNotificationsGrid.ClientID %>").get_masterTableView();
            }
            catch (ex) {
                setTimeout(getNotificationGrid, 100);
            }
        }

        function getrpvNotificationManagerUpdateControl() {
            return "<%=  rpvNotificationManager.ClientID %>";
        }

        function getckbNotyToAdmin() {
            return $get('<%= ckbNotyToAdmin.ClientID %>');
        }

        function getckbNotyToUser() {
            return $get('<%= ckbNotyToUser.ClientID %>');
        }

        function requestStart(object) {
            try {
                $find("<%= RadAjaxLoadingPanel1.ClientID%>").show(object);
            }
            catch (e) {
                null;
            }
        }

        function responseEnd(object) {
            try {
                $find("<%= RadAjaxLoadingPanel1.ClientID%>").hide(object);
            }
            catch (e) {
                null;
            }
        }
        
    </script>
</telerik:RadScriptBlock>
<body onload="getInfo()">
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"  EnablePageMethods="true" EnablePartialRendering="true"></telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
				<telerik:AjaxSetting AjaxControlID="AjaxControlID1">
					<UpdatedControls>
						<telerik:AjaxUpdatedControl ControlID="Loading" LoadingPanelID="RadAjaxLoadingPanel1" />
					</UpdatedControls>
				</telerik:AjaxSetting>
			</AjaxSettings>
        </telerik:RadAjaxManager>
        
        
        <telerik:RadTabStrip ID="rtsNotificationManager" runat="server" SelectedIndex="0" MultiPageID="rmpNotificationManager" Skin="Metro"></telerik:RadTabStrip>
        <telerik:RadMultiPage ID="rmpNotificationManager" runat="server" SelectedIndex="0">
            <telerik:RadPageView ID="rpvNotificationManager" runat="server">
                <table>
                <tr>
                    <td colspan="3">
						<table class="auto-style2">
                            <tr>
                                <td>
				                    <fieldset>
					                    <legend>Compañias Registradas</legend>
					                        <telerik:RadGrid ID="rgCompaniesGrid" runat="server" AllowMultiRowSelection="False" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100px" OnNeedDataSource="rgCompaniesGrid_NeedDataSource" Skin="Metro" Width="275">
						                        <ClientSettings>
							                        <Selecting AllowRowSelect="True" />
							                        <ClientEvents OnRowClick="CompaniesGrid_OnRowClick" />
							                        <Scrolling AllowScroll="True" UseStaticHeaders="False" />
						                        </ClientSettings>
						                        <MasterTableView ClientDataKeyNames="CompanyID" NoMasterRecordsText="No hay compañias registradas">
							                        <CommandItemSettings ExportToPdfText="Export to PDF" />
							                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
							                        </RowIndicatorColumn>
							                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
							                        </ExpandCollapseColumn>
							                        <Columns>
								                        <telerik:GridBoundColumn DataField="CompanyID" FilterControlAltText="Filter Description column" HeaderText="ID" UniqueName="CompanyID" Visible="false">
								                        </telerik:GridBoundColumn>
								                        <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Description column" HeaderText="Nombre" Visible="true">
								                        </telerik:GridBoundColumn>
							                        </Columns>
							                        <EditFormSettings>
								                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
								                        </EditColumn>
							                        </EditFormSettings>
						                        </MasterTableView>
						                        <FilterMenu EnableImageSprites="true">
						                        </FilterMenu>
					                        </telerik:RadGrid>
				                    </fieldset>
			                    </td>

                            </tr>
                            <tr>
                                <td>
				                    <fieldset>
					                    <legend>Notificaciones Registradas</legend>
					                        <telerik:RadGrid ID="rgNotificationsGrid" runat="server" AllowMultiRowSelection="False" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100px" OnNeedDataSource="rgNotificationsGrid_NeedDataSource" Skin="Metro">
						                        <ClientSettings>
							                        <Selecting AllowRowSelect="True" />
							                        <ClientEvents OnRowClick="NotificationsGrid_OnRowClick" />
							                        <Scrolling AllowScroll="True" UseStaticHeaders="False" />
						                        </ClientSettings>
						                        <MasterTableView ClientDataKeyNames="NotificationID" NoMasterRecordsText="No hay notificaciones registradas">
							                        <CommandItemSettings ExportToPdfText="Export to PDF" />
							                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
							                        </RowIndicatorColumn>
							                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
							                        </ExpandCollapseColumn>
							                        <Columns>
								                        <telerik:GridBoundColumn DataField="NotificationID" FilterControlAltText="Filter Description column" HeaderText="ID" UniqueName="NotificationID" Visible="false">
								                        </telerik:GridBoundColumn>
								                        <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Description column" HeaderText="Nombre" Visible="true">
								                        </telerik:GridBoundColumn>
							                        </Columns>
							                        <EditFormSettings>
								                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
								                        </EditColumn>
							                        </EditFormSettings>
						                        </MasterTableView>
						                        <FilterMenu EnableImageSprites="true">
						                        </FilterMenu>
					                        </telerik:RadGrid>
				                    </fieldset>
			                    </td>
                            </tr>
                            <tr>
                                <td>
				                    <fieldset>
					                    <legend>Geo Cercas Registradas</legend>
					                        <telerik:RadGrid ID="rgGeoFenceGrid" runat="server" AllowMultiRowSelection="False" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100px" OnNeedDataSource="rgGeoFenceGrid_NeedDataSource" Skin="Metro">
						                        <ClientSettings>
							                        <Selecting AllowRowSelect="True" />
							                        <ClientEvents OnRowClick="GeoFenceGrid_OnRowClick" />
							                        <Scrolling AllowScroll="True" UseStaticHeaders="False" />
						                        </ClientSettings>
						                        <MasterTableView ClientDataKeyNames="GeoFenceID" NoMasterRecordsText="No hay Geo Cercas registradas">
							                        <CommandItemSettings ExportToPdfText="Export to PDF" />
							                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
							                        </RowIndicatorColumn>
							                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
							                        </ExpandCollapseColumn>
							                        <Columns>
								                        <telerik:GridBoundColumn DataField="GeoFenceID" FilterControlAltText="Filter Description column" HeaderText="ID" UniqueName="GeoFenceID" Visible="false">
								                        </telerik:GridBoundColumn>
								                        <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Description column" HeaderText="Nombre" Visible="true">
								                        </telerik:GridBoundColumn>
							                        </Columns>
							                        <EditFormSettings>
								                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
								                        </EditColumn>
							                        </EditFormSettings>
						                        </MasterTableView>
						                        <FilterMenu EnableImageSprites="true">
						                        </FilterMenu>
					                        </telerik:RadGrid>
				                    </fieldset>
			                    </td>
                            </tr>
                            <tr>
                                <td>
				                    <fieldset>
					                    <legend>Grupo de GPS Registrados</legend>
					                    <telerik:RadGrid ID="rgGPSGroupsGrid" runat="server" AllowMultiRowSelection="False" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100px" OnNeedDataSource="rgGPSGroupsGrid_NeedDataSource" Skin="Metro">
						                    <ClientSettings>
							                    <Selecting AllowRowSelect="True" />
							                    <ClientEvents OnRowClick="GPSGroupsGrid_OnRowClick" />
							                    <Scrolling AllowScroll="True" UseStaticHeaders="False" />
						                    </ClientSettings>
						                    <MasterTableView ClientDataKeyNames="GPSGroupID" NoMasterRecordsText="No hay grupos de GPSImei registrados">
							                    <CommandItemSettings ExportToPdfText="Export to PDF" />
							                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
							                    </RowIndicatorColumn>
							                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
							                    </ExpandCollapseColumn>
							                    <Columns>
								                    <telerik:GridBoundColumn DataField="GPSGroupID" FilterControlAltText="Filter Description column" HeaderText="ID" UniqueName="GPSGroupID" Visible="false">
								                    </telerik:GridBoundColumn>
								                    <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Description column" HeaderText="Nombre" Visible="true">
								                    </telerik:GridBoundColumn>
							                    </Columns>
							                    <EditFormSettings>
								                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
								                    </EditColumn>
							                    </EditFormSettings>
						                    </MasterTableView>
						                    <FilterMenu EnableImageSprites="true">
						                    </FilterMenu>
					                    </telerik:RadGrid>
				                    </fieldset>
			                    </td>
                            </tr>
                            <tr>
                                <td>
                                    <fieldset>
					                    <legend>GPS Registrados</legend>
                                        <telerik:RadGrid ID="rgGPSStockGrid" runat="server" AllowMultiRowSelection="True" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="100px" OnNeedDataSource="rgGPSStockGrid_NeedDataSource" Skin="Metro">
                                            <ClientSettings>
							                    <Selecting AllowRowSelect="True" />
							                    <ClientEvents OnRowDeselecting="GPSStockGrid_OnRowDeselecting" OnRowSelecting="GPSStockGrid_OnRowSelection" />
							                    <Scrolling AllowScroll="True" UseStaticHeaders="False" />
						                    </ClientSettings>
						                    <MasterTableView ClientDataKeyNames="GPSImei" NoMasterRecordsText="No hay GPSImei registrados">
							                    <CommandItemSettings ExportToPdfText="Export to PDF" />
							                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
							                    </RowIndicatorColumn>
							                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
							                    </ExpandCollapseColumn>
							                    <Columns>
								                    <telerik:GridBoundColumn DataField="GPSImei" FilterControlAltText="Filter Description column" HeaderText="ID" UniqueName="GPSImei" Visible="false">
								                    </telerik:GridBoundColumn>
								                    <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Description column" HeaderText="Nombre" Visible="true">
								                    </telerik:GridBoundColumn>
								                    <telerik:GridClientSelectColumn HeaderText="Mostrar" UniqueName="chkShowClient">
								                    </telerik:GridClientSelectColumn>
							                    </Columns>
							                    <EditFormSettings>
								                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
								                    </EditColumn>
							                    </EditFormSettings>
						                    </MasterTableView>
						                    <FilterMenu EnableImageSprites="true">
						                    </FilterMenu>

                                        </telerik:RadGrid>
                                    </fieldset>
                                </td>
                            </tr>
                            <tr>
                                <td style="text-align: center">
			                        <asp:CheckBox ID="ckbNotyToAdmin" runat="server" onclick="javascript:CheckUncheckckbNotyToAdmin()" Text="Notificar Admin" Checked="false"/>
                                    &nbsp&nbsp&nbsp&nbsp
                                    <asp:CheckBox ID="ckbNotyToUser" runat="server" onclick="javascript:CheckUncheckckbNotyToUser()" Text="Notificar Usuario" Checked="false"/>
                                </td>
		                    </tr>
                            <tr>
                                <td style="text-align: center">
			                        <input id="btnClearGeoFences" type="button" value="Limpiar GeoFence" onclick="clearGeoFenceSelected();" />
                                    &nbsp&nbsp&nbsp&nbsp
                                    <input id="btnUpdateGPSImei" type="button" value="Asociar GPSImei" onclick="isValidToInsertNotifications();" />
                                </td>
		                    </tr>
						</table>
                    </td>
                </tr>
            </table>
            </telerik:RadPageView>
        </telerik:RadMultiPage>
            
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>
    </form>
</body>
</html>
